import req from '@/utils/request';
import * as URL from '@/constants/api';

export function getSearchList(q) {
  return req({
    method: 'get',
    url: URL.SEARCH_LIST,
    params: {

      q, //  to do
    }

  })
    .then(res => res.data.data.options) // 答案写法  .then((res) => res.data.data.options.filter(o => o?.trim()))
    .catch(() => [])
}

export function getSearchResult(q) {
  return req({
    url: URL.SEARCH,
    // url: 1+URL.SEARCH,
    params: {

      q, //  to do
    }

  })
    .then(res => res.data.data.results)
    .catch(() => null)
}
